package services

import (
	"context"
	"dawncloud/types"

	"github.com/go-kit/kit/endpoint"
)

type HomeService struct {
}

// 总览 页面
func (svc HomeService) ServiceHome(ctn string) (string, error) {

	return ctn + ", success", nil
}

var Svc HomeService

func MakeEndpoint(svc HomeService) endpoint.Endpoint {
	return func(_ context.Context, request interface{}) (interface{}, error) {
		req := request.(types.HomeRequest)
		v, err := svc.ServiceHome(req.Content)
		if err != nil {
			return types.HomeResponse{v, -1, ""}, nil
		}
		return types.HomeResponse{v, 0, ""}, nil
	}
}
